Skip to content

fix(canvas): skip learnings hook without Hub connection - #327

Merged
nshki merged 2 commits into
mainfrom
nshki/fix/canvas/hub-only-learnings-hook
Nov 20, 2026
Merged

nshki merged 2 commits into
mainfrom
nshki/fix/canvas/hub-only-learnings-hook

Conversation

@nshki

@nshki nshki commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Why

Copilot CLI asks for elevated permission when the Replica extension registers its learnings prompt hook, even in repositories that are not connected to Hub. That makes starting a session in unrelated directories noisy.

What changes

Register the learnings hook only when the startup repository already has a saved Hub selection or configured Hub URL. The canvas remains available without the hook, and connecting a repository mid-session enables learnings the next time Copilot starts.

The local complete Hub suite could not finish because the devcontainer could not reach the npm registry; that check remains for CI.

Register the prompt hook only when the startup repository already has a Hub origin, preserving learnings where they can be used without prompting in unrelated directories.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f0ca06a2-d2d5-4dde-967f-970c6fcec0aa
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 18:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The no-origin tests do not isolate REPLICA_HUB_ORIGIN, causing assertions to fail when the documented development override is set in the invoking shell.

1 open issue
What changed in this PR

This PR avoids unnecessary Copilot CLI permission prompts by registering the learnings hook only when the startup repository has a saved Hub selection or configured Hub URL. The prototype canvas remains available without the hook.

Changes:

  • Share Hub-origin resolution between startup checks and prompt recall.
  • Add tests for disconnected startup, configured origins, and invalid saved origins.
  • Document next-session activation and bump the plugin to 1.5.7.
File Description
.github/​extensions/​replica-prototype/​register-prototype-canvas/​index.test.mjs Tests canvas registration without the learnings hook.
.github/​extensions/​replica-prototype/​register-prototype-canvas/​index.mts Conditionally registers the hook at startup.
.github/​extensions/​replica-prototype/​register-prototype-canvas/​index.mjs Mirrors conditional registration in the runtime module.
.github/​extensions/​replica-prototype/​README.md Explains startup gating and next-session activation.
.github/​extensions/​replica-prototype/​plugin.json Bumps the plugin version to 1.5.7.
.github/​extensions/​replica-prototype/​create-learnings-hook/​index.test.mjs Tests Hub-origin detection and invalid saved data.
.github/​extensions/​replica-prototype/​create-learnings-hook/​index.mts Extracts shared resolution and adds the startup check.
.github/​extensions/​replica-prototype/​create-learnings-hook/​index.mjs Mirrors resolution and detection in the runtime module.

Review effort: Balanced (adaptive)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f0ca06a2-d2d5-4dde-967f-970c6fcec0aa
@nshki
nshki marked this pull request as ready for review November 20, 2026 18:21
@nshki
nshki requested a review from a team as a code owner November 20, 2026 18:21
@nshki
nshki merged commit 089c9e0 into main Nov 20, 2026
40 checks passed
@nshki
nshki deleted the nshki/fix/canvas/hub-only-learnings-hook branch November 20, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants